cmake_minimum_required(VERSION 3.10.0)

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Specified the language standard
# set(CMAKE_C_STANDARD 99)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_C_COMPILER "/usr/bin/gcc-10")
set(CMAKE_CXX_COMPILER "/usr/bin/g++-10")

# Configure compile options
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive -fsanitize=address")

# set(CMAKE_BUILD_TYPE "Debug")
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")

project("test" VERSION 1.0.0 LANGUAGES C CXX DESCRIPTION "test project")

set(CMAKE_INSTALL_PREFIX ${PROJECT_SOURCE_DIR}/out)
message(STATUS "CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX}")
##--------------------- Global Macros --------------------------------------##
# add_definitions(-DDEBUG)

file(GLOB ALL_SUB RELATIVE ${PROJECT_SOURCE_DIR} "${PROJECT_SOURCE_DIR}/src/*")
foreach(sub ${ALL_SUB})
if (IS_DIRECTORY "${PROJECT_SOURCE_DIR}/${sub}")
    add_subdirectory(${sub})
endif()
endforeach()

# Package, These variables should set before including CPack module
set(CPACK_GENERATOR "ZIP")
set(CPACK_SET_DESTDIR ON)  # 支持指定安装目录
include(CPack)


